package com.ruoyi.quartz.task;

import com.ruoyi.common.zq.mapper.EntryBlankMapper;
import com.ruoyi.common.zq.mapper.ZqVolunteerActivityMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 志愿者活动定时任务执行
 *
 * @Author: LoneyFeather
 * @Date: Created in 12:10 2021/12/24
 */
@Slf4j
@Component("volunteerAct-iveTask")
public class VolunteerActiviteTask {

    @Autowired
    private ZqVolunteerActivityMapper activityMapper;

    @Autowired
    private EntryBlankMapper entryBlankMapper;

    /**
     * 打开活动报名接口
     * @param activityId
     */
    public void openActivity(Long activityId){
        log.info("执行定时任务开启报名： " + activityId);
        System.out.println("执行定时任务开启报名： " + activityId);
        activityMapper.updateByApplyState(activityId,1);
    }

    /**
     * 关闭活动报名接口
     * @param activityId
     */
    public void closeActivity(Long activityId){
        log.info("执行定时任务关闭报名： " + activityId);
        System.out.println("执行定时任务关闭报名： " + activityId);
        activityMapper.updateByApplyState(activityId,0);
    }

    /**
     * 活动结束
     */
    public void activityEnd(Long activityId){
        activityMapper.updateByApplyState(activityId,2);
        // 修改状态
    }

}
